package org.noote.libs.robot;

public class Robot_AnimationContext {

	protected float _fTime=0;
	protected boolean _bFinished=false;
	
	protected Robot_Skeleton _robot=null;
	
	public Robot_AnimationContext(Robot_Skeleton robot)
	{
		_robot = robot;
	}
	
	public boolean start(Robot_Animation anim)
	{
		_fTime=0;
		_bFinished=false;
		
		return true;
	}
	
	public boolean isFinished()
	{
		return _bFinished;
	}
	
	public void addTime(float fSlice) {
		_fTime += fSlice;
	}
	public float getTime()
	{
		return _fTime;
	}
	
	public boolean setPosition(int iServo, float fPosition)
	{
		Robot_ServoMotor servo = _robot.getServo(iServo);
		if(servo != null)
		{
			servo.setPosition(fPosition);
			return true;
		}
		return false;
	}
	
	public float getPosition(int iServo)
	{
		Robot_ServoMotor servo = _robot.getServo(iServo);
		if(servo != null)
		{
			return servo.getCurrentPosition();
		}
		return 0;
	}

}
